﻿using System.Windows;
using System.Windows.Controls;
using Microsoft.Extensions.DependencyInjection;
using Serilog;

namespace SimpleTool.Capacity
{
    /// <summary>
    /// CapacityUI.xaml 的交互逻辑
    /// </summary>
    public partial class CapacityUI : UserControl
    {
        private readonly static ILogger Logger = Log.ForContext<CapacityUI>();

        private readonly CapacityViewModel? HoldCapacityrViewModel;

        public CapacityUI()
        {
            InitializeComponent();
            App MyApp = (App)Application.Current;
            HoldCapacityrViewModel = MyApp.ServiceProvider.GetRequiredService<CapacityViewModel>();
            HoldCapacityrViewModel.PowerPlantServer.Read<CapacityUI>(HoldCapacityrViewModel.SerialDataReceive);
            DataContext = HoldCapacityrViewModel;
        }
    }
}
